#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
int main (void)
{
	pid_t pid = fork ();	
	if (-1 == pid) {
		perror ("fork()");
		return -1;
	}
	if (0 == pid) {
		//子进程
		while (1) {
			//write (1, "!", 1);
			sleep (1);
			printf ("child pid = %d, ppid = %d\n", getpid(), getppid());
		}
	} else {
	}
	while (1) {
		//write (1, "#", 1);
		sleep (1);
		printf ("parent pid = %d, ppid = %d\n", getpid(), getppid());
	}
	return 0;
}
